home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Camelot / Camelot 134 (1991-10)(Swedish User Group of Amiga)(SE)(PD)[WB].zip / Camelot 134 (1991-10)(Swedish User Group of Amiga)(SE)(PD)[WB].adf / GIFMachine / Sources / myprintf.c < prev    next >
C/C++ Source or Header  |  1991-09-01  |  783b  |  42 lines

  1. #include <clib/dos_protos.h>
  2. extern struct DosLibrary *DOSBase;
  3. #include <pragmas/dos_lib.h>
  4.  
  5. #include <stdarg.h>
  6.  
  7. void RawDoFmt(char *, APTR, void(*)(), APTR);
  8. #pragma syscall RawDoFmt 20a ba9804
  9.  
  10. void __stdargs MyPrintf(char *fmt, ...)
  11. {
  12.     va_list args;
  13.  
  14.     va_start(args, fmt);
  15.     VPrintf((UBYTE *)fmt, (LONG *)args);
  16.     Flush(Output());
  17.     va_end(args);
  18. }
  19.  
  20. static void __regargs MySPrintfSupp(char);
  21.  
  22. void __stdargs MySPrintf(char *buf, char *fmt, ...)
  23. {
  24.     va_list args;
  25.  
  26.     va_start(args, fmt);
  27.     RawDoFmt(fmt, (APTR)args, MySPrintfSupp, (APTR)buf)
  28.     va_end(args);
  29. }
  30.  
  31. extern long __builtin_getreg(int);
  32. extern void __builtin_putreg(int, char *);
  33.  
  34. static void __regargs MySPrintfSupp(char Char)
  35. {
  36.     char *ptr;
  37.  
  38.     ptr = (char *)__builtin_getreg(11);
  39.     *ptr++ = Char;
  40.     __builtin_putreg(11, ptr);
  41. }
  42.